import request from '@/utils/request'
import { GEN_SERVER } from '@/config/baseUrl'

//查询异常规则列表
export function ruleList(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/rule/list',
    method: 'post',
    data: data
  })
}

// 查询异常规则详情
export function ruleDetail(id) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/rule/detail',
    method: 'get',
    params: {
        id
    }
  })
}

// 新增或保存异常规则
export function addOrUpdateRule(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/rule/addOrUpdate',
    method: 'post',
    data: data
  })
}

// 删除/停用规则
export function statusErpFormula(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/rule/deleteById',
    method: 'post',
    data: data
  })
}

// 删除/停用规则
export function delErpFormula(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/rule/deleteByIds',
    method: 'post',
    data: data
  })
}

//获取异常规则编号
export function abnormalNo() {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/rule/seq',
    method: 'get'
  })
}

// 导出
export function exportRule(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + "/abnormal/rule/exportRuleDetail",
    method: "post",
    data,
    responseType: "blob",
  });
}

